package collection;


import java.util.LinkedList;

//linkedlist链表集合功能
public class LinkedListDemo {
    public static void main(String[] args) {
        LinkedList<Integer> list = new LinkedList<Integer>();
        list.add(100);
        list.add(200);
        list.addFirst(500);
        list.addLast(600);
        System.out.println("list: " + list);

        int first = list.getFirst();
        int last = list.getLast();
        System.out.println("first: " + first+",last:"+last);

        list.removeFirst();
        System.out.println("list: " + list);
        list.removeLast();
        System.out.println("list: " + list);

    }
}
